package pb

import (
	"hundsun.com/hsl/hschain/protos/common"
	"hundsun.com/hsl/hschain/protos/ledger"
)

// FormatBlockCheckedMsg 将区块block序列化成BlockCheckedMessage
func FormatBlockCheckedMsg(blk *ledger.Block) *common.BlockCheckedMessage {
	var blkCheckedMsg = &common.BlockCheckedMessage{}
	if blk != nil {
		blkCheckedMsg.BlockNumber = blk.Header.Number
		blkCheckedMsg.BlockSequence = blk.Header.BlockSequence
		blkCheckedMsg.BlockHash = blk.Hash()
		blkCheckedMsg.BlockTime = blk.Header.BlockTime
	}
	return blkCheckedMsg
}
